<template>
  <div>
    <!-- <elselect :areal="arealist" :lablel="'行政区域'"/>
    <elselect :areal="area" :lablel="'市场规模'"/>-->
    <el-table
      v-loading="loading"
      element-loading-text="拼命加载中"
      element-loading-spinner="el-icon-loading"
      element-loading-background="rgba(0, 0, 0, 0.8)"
      :data="tableData"
      style="width: 100%"
    >
      <el-table-column prop="date" label="日期" width="180"></el-table-column>
      <el-table-column prop="name" label="姓名" width="180"></el-table-column>
      <el-table-column prop="address" label="地址"></el-table-column>
    </el-table>
    <el-button type="success" @click="load()">loading按钮</el-button>
    <el-button type="success" @click="load2()">关闭loading按钮</el-button>

    <countTo :startVal="startVal" :endVal="endVal" :duration="3000"></countTo>
  </div>
</template>

<script>
import elselect from "@/views/modules/elselect";
import countTo from "vue-count-to";
export default {
  name: "cs",
  components: {
    elselect,
    countTo
  },
  data() {
    return {
      a: 1,
      arealist: {},
      searchform: {},
      search: "search",
      area: {},
      tableData: [
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        },
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        }
      ],
      loading: true,
      startVal: 0,
      endVal: 2017
    };
  },
  created() {},
  mounted() {
    this.getSearch();
  },
  methods: {
    getSearch() {
      this.$store
        .dispatch("marketInfoMge/getSearch", { keyword: this.search })
        .then(data => {
          // console.log(data);
          // this.searchform = data;
          // console.log(this.searchform)
          var dataarr = [];
          for (var i = 0; i < data.areaCodeList.length; i++) {
            dataarr.push({
              value: data.areaCodeList[i].id,
              lable: data.areaCodeList[i].name
            });
          }
          this.arealist = dataarr;
          console.log(this.arealist);

          var dataarr = [];
          for (var i = 0; i < data.area.length; i++) {
            dataarr.push({
              value: data.area[i].id,
              lable: data.area[i].name
            });
          }
          this.area = dataarr;
          console.log(this.area);
        })
        .catch(err => {
          console.log(err);
        });
    },
    load() {
      console.log(111);
      this.loading = false;
    },
    load2() {
      console.log(111);
      this.loading = true;
    }
  }
};
</script>
<style lang="scss" scoped>
</style>